<template>
<table>
    <tr>
        <td>用户名</td>
        <td><input type="text" v-model="info.name"></td>
    </tr>
    <tr>
        <td>密码</td>
        <td><input type="password" v-model="info.pwd"></td>
    </tr>
    <tr>
        <td colspan="2">
            <input type="button" value="登录" @click="login"/>
        </td>
    </tr>
</table>
</template>

<script setup lang="ts">

import {useRouter} from 'vue-router'
import {ref} from 'vue'

const router=useRouter()
const info=ref({
    name:"",
    pwd:""
})

const login=()=>{
    if(info.value.name==""){
        alert('用户名不能为空')
        return
    }
    if(info.value.pwd==""){
        alert('密码不能为空')
        return
    }
    if(info.value.name=="Admin123"&&info.value.pwd=="Admin123"){
        router.push({
            name:"infos",
            params:{
                name:info.value.name,
                pwd:info.value.pwd
            }
        })
    }
        
    
}
</script>